fix: prevent updating check state before mempool insert#25550
fix: prevent updating check state before mempool insert#25550beer-1 wants to merge 20 commits intocosmos:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25550 +/- ##
=======================================
Coverage 68.24% 68.24%
=======================================
Files 894 894
Lines 58158 58168 +10
=======================================
+ Hits 39688 39697 +9
- Misses 18470 18471 +1
🚀 New features to boost your workflow:
|
|
@beer-1 lint failing |
|
@aljo242 fixed! |
|
@beer-1 do you see any potential for performance overhead due to this? |
I don't think this introduce any performance degradation because it is just changing order of execution |
|
comment to prevent stale closing |
| } | ||
|
|
||
| if mode == execModeCheck { | ||
| mempoolCtx = ctx.WithMultiStore(msCache) |
There was a problem hiding this comment.
confirming my understanding here, we need to set the multistore for mempoolCtx back to to msCache since we are now not writing msCache before calling mempool.Insert when in modeCheck. So if we do not use msCache as our multistore, mmempool.Insert may operate on a stale multistore. Once we do call commitAnteCache though, we are safe to use ctx again since its ms has now been updated.
There was a problem hiding this comment.
I modified the mempool.Insert call locally to use ctx instead of mempoolCtx and all of our unit tests still passed. Could you think of a unit test that would demonstrate this ms requirement? imo its not super clear from this logic that that is required (would probably be easiest with a mock mempool and ante handler just checking values in the ms).
Description
Closes: #25543